package com.sqx.modules.creation.controller.app;


import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.creation.entity.dto.HandleUserBehaviorDto;
import com.sqx.modules.creation.service.FollowsUserService;
import com.sqx.modules.creation.service.UserBehaviorService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户行为 前端控制器
 * </p>
 *
 * @author author
 * @since 2024年09月03日
 */
@RestController
@RequestMapping("/app/userBehavior")
public class AppUserBehaviorController {
    @Autowired
    private UserBehaviorService userBehaviorService;
    @Autowired
    private FollowsUserService followsUserService;
    /**
     * 关注/取消关注
     * @param handleUserBehaviorDto
     */
    @Login
    @PostMapping("/handleUserBehavior")
    public Result handleUserBehavior(@RequestAttribute("userId") Long userId,@RequestBody HandleUserBehaviorDto handleUserBehaviorDto) {
        return userBehaviorService.handleUserBehavior(userId,handleUserBehaviorDto);
    }


    /**
     * 我的关注
     * @return
     */
    @Login
    @GetMapping("/myFollowsUser")
    public Result myFollowsUser(@RequestAttribute("userId") Long userId,Integer page, Integer limit) {
        return followsUserService.myFollowsUser(userId,page,limit);
    }


}

